<template>
  <div class="sending">
    <van-cell-group v-for="item in single" :key="item.id" :border="false">
      <van-cell :border="false" :title="item.seller_id==0?'总部':item.spf_name" title-style="font-weight: bold;" @click="toDetail(item.id)" />
      <van-cell :border="false" :title="item.receiver.username + ' ' + item.receiver.phone" @click="toDetail(item.id)">
        <template #label>
          <div class="sending-pd">{{item.receiver.province + item.receiver.city + item.receiver.district + item.receiver.address}}</div>
        </template>
      </van-cell>
      <van-cell :border="false" :title="'共 ' + item.products_num +' 件商品'" :value="'￥' + item.realFee" value-class="sending-money" />
      <div class="spacing"></div>
    </van-cell-group>
    <van-empty description="暂无数据" v-if="single.length == 0" />
  </div>
</template>
          
<script>
export default {
  name: 'Sending', // 配送中
  data () {
    return {
      single: [],
    }
  },
  methods: {
    toDetail (sid) {
      this.$router.push({ path: `/historysDetail/${sid}` })
    },
    getSending () {
      this.$axios("/buy/myorderlist", {
        state: 3, //-2 审核失败  -1: 审核状态   0: 未支付   1：下单支付配货中  3：配送中   4:已完成配送  10：已退款
        page: 1, //分页页码，数字类型
        limit: 10,
      })
        .then((res) => {
          this.single = res.data.data
        })
        .catch((err) => {
          console.error(err);
        });
    },
  },
  created () {
    this.getSending()
  },
}
</script>


<style lang="less" scoped>
.sending {
  height: 100%;
  background-color: #f7f8fa;
  .spacing {
    width: 100%;
    height: 15px;
    background-color: #f7f8fa;
  }
  &-swipe-button {
    height: 100%;
  }
  &-money {
    color: #e55252;
    font-weight: bold;
  }
}
</style>